<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>

</head>

<body>
    <div id='root'>

        <h2>你好{{h1}}</h2>
        <h2>嘻嘻哈哈{{h2}}</h2>
        姓: <input type="text" v-model="firstName"> <br>
        名: <input type="text" v-model="lastName"> <br>
        全名: <span>{{firstName + '-' + lastName}}</span> <br>


        姓2: <input type="text" v-model="firstName2"> <br>
        名2: <input type="text" v-model="lastName2"> <br>
        全名2: <span>{{funName()}}</span> <br>


    </div>
    <script type="text/javascript">

        new Vue({
            el: '#root',
            data: {
                h1: '不好',
                h2: '哈哈',
                firstName: '刘',
                lastName: '昭博',
                firstName2: '刘',
                lastName2: '昭博',
            },
            methods: {
                funName() {
                    return this.firstName2 + '-' +this.lastName2
                }
            }
        })
    </script>
</body>

</html>